//
//  MyOrderViewCell.swift
//  iModern
//
//  Created by Ralf on 6/5/15.
//  Copyright (c) 2015 com.starlooking. All rights reserved.
//

import UIKit
import ImageLoader

class MyOrderViewCell: AdvertisingCell
{
    override func awakeFromNib()
    {
        super.awakeFromNib()
    }

    override func setSelected(selected: Bool, animated: Bool)
    {
        super.setSelected(selected, animated: animated)
    }

    func setData(data: NSMutableDictionary)
    {
        _ = data

        let advertising = data["advertising"] as! [String:AnyObject]
        let contact     = advertising["contact"] as! [String:AnyObject]

//        setAliasLabel(contact["alias"] as! String)
        setNumberOfFavoritesButton(String(advertising["numberOfFavorites"] as! Int))
        setNumberOfCommentsButton(String(advertising["numberOfComment"] as! Int))
        setAvatarImageView(contact["thumbnailURL"] as? String)
        setPreviewImageView(advertising["imageURL"] as! String)

        setSummaryLabel(advertising["summary"] as! String)
    }

    func loadImage(advertising: [String:AnyObject])
    {
        let ivPreview = self.viewWithTag(__preview_image_view_tag) as! UIImageView
        let imageURL  = advertising["imageURL"] as! String
        ivPreview.load("\(appDelegate.parameterManager.server)/\(imageURL)", placeholder: nil)
    }
}
